﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Configuration;
using System.Diagnostics;
using System.Threading;
namespace CmsPageCreator
{
    public partial class CmsPageCreatorForm : Form
    {
        CmsCreatorSetting settings = new CmsCreatorSetting();
        public CmsPageCreatorForm()
        {
            InitializeComponent();
        }
        /// <summary>
        ///启动生成文章正文页菜单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Menu_ArticleContent_Start_Click(object sender, EventArgs e)
        {
            if (!ArticleContentTimer.Enabled)
            {
                ArticleContentTimer.Enabled = true;
            }
            ArticleContentTimer.Start();
            ArticleContentTimer.Interval = 500;
        }

        private void ArticleContentTimer_Tick(object sender, EventArgs e)
        {
            //do something...
            
            contentProgressBar.Maximum = 34;
            if (contentProgressBar.Value < contentProgressBar.Maximum)
            {
                contentProgressBar.Increment(1);
            }
            else {
                contentProgressBar.Value = 0;
            }           
            
        }

        private void ArticleListTimer_Tick(object sender, EventArgs e)
        {
            //do something...

            listProgressBar.Maximum = 35;
            if (listProgressBar.Value < listProgressBar.Maximum)
            {
                listProgressBar.Increment(1);
            }
            else
            {
                listProgressBar.Value = 0;
            }           
        }

        private void PositionTimer_Tick(object sender, EventArgs e)
        {
            //do something...

            positionProgressBar.Maximum = 34;
            if (positionProgressBar.Value < positionProgressBar.Maximum)
            {
                positionProgressBar.Increment(1);
            }
            else
            {
                positionProgressBar.Value = 0;
            }           
            
        }

        private void CmsPageCreatorForm_FormClosed(object sender, FormClosedEventArgs e)
        {
             this.Dispose(true);
        }

        private void CmsPageCreatorForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            contentProgressBar.Dispose();
            process.Dispose();

        }

        private void CmsPageCreatorForm_Load(object sender, EventArgs e)
        {

        }

        private void Menu_Position_Start_Click(object sender, EventArgs e)
        {
            if (!PositionTimer.Enabled)
            {
                PositionTimer.Enabled = true;
            }
            PositionTimer.Start();
            PositionTimer.Interval = 500;
        }

        private void Menu_ArticleList_Start_Click(object sender, EventArgs e)
        {
            if (!ArticleListTimer.Enabled)
            {
                ArticleListTimer.Enabled = true;
            }
            ArticleListTimer.Start();
            ArticleListTimer.Interval = 500;
        }
    }
}
